<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>桐州监狱指挥中心信息管理系统</title>
    <link rel="stylesheet" type="text/css" href="/static/easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/static/easyui/demo/demo.css">
    <script type="text/javascript" src="/static/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/static/easyui/jquery.easyui.min.js"></script>
    <script>
        
        
        $(function () {
            $('body').bind('keyup', function(event) {
                if (event.keyCode == "13") {
                    event.preventDefault();
                    dologin()
                }
            });
        });
        
        function changeVeryfy() {
            $("#verifyImg").attr('src', '/passport/getVerify?time=' + Math.random());
        }
        function dologin() {
            $("#btn").attr('disabled', true);
            var username = $('#username').val();
            if (username.length == 0) {
                return;
            }
            var password = $('#password').val();
            if (password.length == 0) {
                return;
            }
            var verifyCode = $('#verifyCode').val();
            if (verifyCode.length == 0) {
                return;
            }
            $.ajax({
                url: "/passport/doLogin",
                type: "POST",
                dataType: "json",
                async: false,
                data: {
                    username: username,
                    password: password,
                    verifyCode: verifyCode
                },
                success: function (data) {
                    $("#btn").attr('disabled', false);
                    if (data.code == '200') {
                        $(location).attr('href', '/management/index');
                    } else {
                        $("#verifyImg").attr('src', '/passport/getVerify?time=' + Math.random());
                        $('#errorMsg').text(data.errDetail);
                        $('#errorMsg').show();
                    }
                },
                error: function () {
                    $("#btn").attr('disabled', false);
                }
            });
        }
    </script>
</head>
<body style="background: #B3DFDA">
<div id="w" class="easyui-window" title="登录"
     data-options="draggable:false,resizable:false,modal:true,closed:false,iconCls:'Lockgo',closable:false,minimizable:false"
     style="width:400px;padding:20px 70px 20px 70px;">

    <div style="margin-bottom:10px">
        <input class="easyui-textbox" id="username" style="width:100%;height:30px;padding:12px"
               data-options="prompt:'账号',iconCls:'icon-man',iconWidth:38">
    </div>
    <div style="margin-bottom:20px">
        <input class="easyui-textbox" id="password" type="password" style="width:100%;height:30px;padding:12px"
               data-options="prompt:'登录密码',iconCls:'icon-lock',iconWidth:38">
    </div>
    <div style="margin-bottom:20px">
        <input class="easyui-textbox" type="text" id="verifyCode" style="width:50%;height:30px;padding:12px"
               data-options="prompt:'验证码'"> <a href="javascript:;" class="showcode" onclick="changeVeryfy()"><img
            id="verifyImg"
            style=" margin:0 0 0 3px ; vertical-align:middle; height:26px;" src="/passport/getVerify"></a>
    </div>
    <div id="errorMsg" style="display: none;color: red;margin-bottom: 20px;">
    </div>
    <div style="margin-bottom:20px;color: cornflowerblue">
        如密码遗失请联系管理员
    </div>
    <div>
        <a id="btn-doLogin" href="javascript:;" onclick="dologin()" class="easyui-linkbutton"
           data-options="iconCls:'icon-ok'"
           style="padding:5px 0px;width:100%;">
            <span style="font-size:14px;">登录</span>
        </a>
    </div>
</div>
</body>
</html>